import { BasicColumn, FormSchema } from '@/components/Table'
import { h } from 'vue'
import { Tag } from 'ant-design-vue'

export const columns: BasicColumn[] = [
  {
    title: '组织编码',
    dataIndex: 'orgCode',
  },
  {
    title: '组织名称',
    dataIndex: 'orgName',
  },
  {
    title: '上级组织',
    dataIndex: 'parentOrgName',
  },
  {
    title: '责任人',
    dataIndex: 'bossName',
  },
  {
    title: '备注',
    dataIndex: 'description',
  },
]

export const searchFormSchema: FormSchema[] = [
  {
    field: 'orgCode',
    label: '组织编码',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'orgName',
    label: '组织名称',
    component: 'Input',
    colProps: { span: 6 },
  },
]

export const formSchema: FormSchema[] = [
  {
    field: 'orgCode',
    label: '组织编码',
    component: 'Input',
    required: true,
  },
  {
    field: 'orgName',
    label: '组织名称',
    component: 'Input',
    required: true,
  },
  {
    field: 'orgCode',
    label: '部门名称',
    component: 'Input',
    required: true,
  },
  {
    field: 'orgLevel',
    label: '组织序号',
    component: 'InputNumber',
    required: true,
  },
  {
    field: 'parentOrgId',
    label: '上级组织',
    component: 'TreeSelect',
    // ifShow({ values }) {
    //   const { orgName, parentOrgName } = values;
    //   // Hide without a parentDept when editing
    //   return parentOrgName || (!orgName && !parentOrgName);
    // },
    componentProps: {
      fieldNames: {
        label: 'name',
        // key: 'id',
        value: 'id',
        children: 'childList',
      },
      getPopupContainer: () => document.body,
    },
    // required: true,
  },
  {
    label: '组织描述',
    field: 'description',
    component: 'InputTextArea',
  },
]
